package com.bawei.demo_recyclerview;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yaotianxue
 * @description 
 * @date 2025/5/14
 */
public class RemindAdapter extends RecyclerView.Adapter<RemindAdapter.RemindViewHolder> {
    private List<RemindEntity> list = new ArrayList<>();

    public void setList(List<RemindEntity> list){
        this.list.clear();
        this.list.addAll(list);
        notifyDataSetChanged();
    }
    @NonNull
    @Override
    public RemindViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new RemindViewHolder(View.inflate(parent.getContext(), R.layout.remind_completed_recycle_item_view, null));
    }

    @Override
    public void onBindViewHolder(@NonNull RemindViewHolder holder, int position) {
            holder.textView.setText(list.get(position).getRemindTitle());

    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class RemindViewHolder extends RecyclerView.ViewHolder {
        public TextView textView;


        public RemindViewHolder(@NonNull View itemView) {
            super(itemView);
            textView = itemView.findViewById(R.id.tv);
        }
    }
}
